package main
import "fmt"

func sum(s []int, c chan int) {
	sum:=0
	for _,v := range s {
		sum+=v
	}

	c <- sum
}

func main() {
	s:=make([]int, 100)
	for i:=0; i<100; i++ {
		s[i]=i
	}

	c:=make(chan int)
	go sum(s[:len(s)/2], c)
	go sum(s[len(s)/2:], c)

	part1,ok1:= <-c
	part2,ok2:= <-c
	sum:=part1+part2

	fmt.Println(part1,ok1)
	fmt.Println(part2,ok2)
	fmt.Println(sum)
}
